<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 4.01 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/pages/safeai/jsp/common/taglibs.jsp"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>优惠券编辑页面</title>
<link href="css/together.css" rel="stylesheet" type="text/css" />
<link type="text/css" rel="StyleSheet" media="all" href="${ctx}/css/combined.css">
<link type="text/css" rel="StyleSheet" media="all" href="${ctx}/css/global.css">
<link href="${ctx}/css/jquery.popup.css" rel="stylesheet" type="text/css">
<link href="${ctx}/css/jquery.treeview.css" rel="stylesheet" type="text/css">
<link href="${ctx}/css/safeai/together.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="${ctx}/js/calendar.js"></script>
<script type="text/javascript" src="${ctx}/js/calendar-zh.js"></script>
<script type="text/javascript" src="${ctx}/js/calendar-setup.js"></script>
<script language="javascript" src="${ctx}/script/common/jquery.js"></script>
<script language="javascript" src="${ctx}/script/common/jquery.treeview.js"></script>
<script language="javascript" src="${ctx}/script/common/jquery.cookie.js"></script>
<script language="javascript" src="${ctx}/script/common/jquery.dimensions.js"></script>
<script language="javascript" src="${ctx}/script/common/jquery.popup.js"></script>
<script type="text/javascript" src="${ctx}/script/product/catalog.js"></script>
<script type="text/javascript" src="${ctx}/dwr/interface/catalogHelper.js"></script>
<script type='text/javascript' src='${ctx}/dwr/interface/filterService.js'></script>
<script type='text/javascript' src='${ctx}/dwr/interface/productService.js'></script>
<script type='text/javascript' src='${ctx}/dwr/engine.js'></script>
<script type="text/javascript" src="${ctx}/script/common/common.js"></script>
<script type="text/javascript" src="${ctx}/script/product/product.js"></script>
<script type="text/javascript">
     $(document).ready(function(){
			jQuery(function($){
				    $("input#catalog").popup(builderTreeTag(2));
				    $(".treeview-popup").treeview({ 
			        persist: "cookie",
			        cookieId: "treeview-popup"
		        });
			    });
  	$("ul.treeview-popup li>a").click(function(){
  		document.getElementById("catalogId").value = this.id;
	  });
	})
 
    // Hack to avoid bug in jscalendar - JRA-7713
    if (!Calendar._TT["WEEKEND"]) Calendar._TT["WEEKEND"] = "0,6";
    if (!Calendar._TT["DAY_FIRST"]) Calendar._TT["DAY_FIRST"] = "Display %s first";
    
   function chen1(){
    	var youshi = document.getElementById("youshi").value;
    	var zhengze = /^[0-9]*$/;
    	if(zhengze.exec(youshi)){
    		document.getElementById("ecouponForm").submit();
		}else{
			alert("格式错误");
		}
    }
</script>
</head>
<body>
<form action="${ctx}/ecoupon.do" id="ecouponForm" method="post">
<table align="center" width="955" height="418">
	<tr>
	<input type="hidden" name="method" value="Update">
    	<th colspan="4" height="25px">编辑优惠信息</th>
    </tr>
    <tr>
    	<td class="td_01" nowrap>优惠名称：</td>
      	<td class="td_04">
        	<input type="text" name="name" size="20px" id="textfield" value="${ecoupon.name}" />        </td>
        <td class="td_01" nowrap>状态：</td>
      <td class="td_04">
		<html:select name="ecoupon" property="struts">
			<html:option value="0">有效</html:option>
			<html:option value="1">无效</html:option>
		</html:select>
      </td>
    </tr>
    <tr>
    	<td class="td_01" nowrap>生效日期：</td>
      	<td class="td_04">
			<input name="ecoupon.startimeStr" id="created:start" value="${ecoupon.startimeStr}"  type="text" / style="background-image:url(${ctx}/images/cal.gif); background-repeat:no-repeat; background-position:left;padding-left:25px; cursor:hand;width:176px"> 
			<script type="text/javascript">
		    	Calendar.setup({
		
		        firstDay       :    0,                  // first day of the week
		        inputField     :    "created:start",     // id of the input field
		        button         :    "created:start_trigger_c",  // trigger for the calendar (button ID)
		        align          :    "Bl",           // alignment (defaults to "Bl")
		        singleClick    :    true,
		             ifFormat       : "%y/%m/%d"      // our date only format
		         });
            </script>
      	</td>
        <td class="td_01" nowrap>失效日期：</td>
      	<td class="td_04">
			<input name="ecoupon.endtimeStr" id="created:after" value="${ecoupon.endtimeStr}"  type="text" / style="background-image:url(${ctx}/images/cal.gif); background-repeat:no-repeat; background-position:left;padding-left:25px; cursor:hand;width:176px"> 
			<script type="text/javascript">
		    	Calendar.setup({
		
		        firstDay       :    0,                  // first day of the week
		        inputField     :    "created:after",     // id of the input field
		        button         :    "created:after_trigger_c",  // trigger for the calendar (button ID)
		        align          :    "Bl",           // alignment (defaults to "Bl")
		        singleClick    :    true,
		             ifFormat       : "%y/%m/%d"      // our date only format
		         });
            </script>
      	</td>
  </tr>
    <tr>
    	<td class="td_01" nowrap>描述信息：</td>
     	<td colspan="3" class="td_04">
        	<textarea name="description" id="textarea" cols="45" rows="4">${ecoupon.description}</textarea>
        </td>
    </tr>
    <tr>
    	<td class="td_01" nowrap>产品类别：</td>
      	<td class="td_04">
      		<input id="catalogId" name="ecoupon.catalogId" type="hidden"/>
      		<input id="catalog" type="text" value="${catalogName}"/> 
      	</td>
        <td class="td_01" nowrap>品&nbsp;&nbsp;牌：</td>
        <td class="td_04">
	        <select name="pinpai" id="select"> 
				<option value="0">--ALL--</option>
				<logic:iterate id="bList" name="BrandList"> 
					<logic:equal name="bList" property="id" value="${ecoupon.producttype}">
						<option value="<bean:write name="bList" property="id"/>" selected><bean:write name="bList" property="name"/></option>
				    </logic:equal>
					<logic:notEqual name="bList" property="id" value="${ecoupon.producttype}">
						<option value="<bean:write name="bList" property="id"/>"><bean:write name="bList" property="name"/></option>
				    </logic:notEqual>
			    </logic:iterate>
		    </select>
        </td>
    </tr>
     <tr>
    	<td class="td_01" nowrap>具体产品：</td>
      	<td class="td_04">
			<input type="hidden" name="ecoupon.productid11" id="ecoupon.productid" value="${ecoupon.productid}">
	        <input type="text" name="product" size="12px" id="product" value="${productName}"/>&nbsp;&nbsp;
	    	<input type="button" value="搜索" class="btn" onclick="window.open('${ctx}/ecoupon.do?method=search&productname='+encodeURI(document.getElementById('product').value))"/>
        </td>
        <td class="td_01" nowrap>订单金额下限：</td>
        <td class="td_04">
        	<!-- <input type="text" name="xiaxian" size="20px" id="textfield" disabled="disabled" value="${ecoupon.minmoney}"/>&nbsp; &nbsp; 不可改 -->
        	${ecoupon.minmoney}
        </td>
    </tr>
     <tr>
    	<td class="td_01" nowrap>优惠券金额：</td>
      	<td class="td_04">
        	<!-- <input type="text" name="jie" size="20px" id="textfield" disabled="disabled" value="${ecoupon.favourablemoney}"/>&nbsp;&nbsp; 不可改 -->   
        	${ecoupon.favourablemoney}
        </td>
        <td class="td_01" nowrap>允许使用次数：</td>
        <td class="td_04">
        	<input type="text" name="cishu" size="20px" id="youshi" value="${ecoupon.maxtimes}"/>        
        </td>
    </tr>
     <tr>
    	<td class="td_01" nowrap>优惠券张数</td>
      	<td colspan="3" class="td_04">
        	<!-- <input type="text" name="zhangshu" size="20px" id="textfield" value="${zhangshu}" disabled="disabled"/> --> 
        	${BrandList11111} 
        	<input type="hidden" name="bianhao" value="${ecoupon.ecouponno}">
        	<input type="hidden" name="ecouponID" value="${ecoupon.id}"> 
        	<input type="hidden" name="ecouponLagoid" value="${ecoupon.lagoid}"> 
        </td>
    </tr>
     <tr>
    	<td colspan="4" align="center">
        	<input name="" value="确认修改" type="button" class="btn" onclick="chen1()"/>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <input name="" value="取&nbsp;&nbsp;消" type="button" class="btn" onclick="javascript:window.location.href='${ctx}/ecoupon.do?method=toquery'"/>
		</td>
   	</tr>
</table>
</form>
</body>
</html>
